<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>佛航货运平台</title>
    <script type="text/javascript" src="<s:url value="../js/jquery.js"/>"></script>
    <script type="text/javascript" src="<s:url value="/js/layer/layer.js"/>"></script>
    <script type="text/javascript">
        $(function () {
            if ("${userService.deviceCode}") {
                $("#bind").html("更改绑定");
            } else {
                $("#acceptMsgTR").hide();
                $("#bind").html("立即绑定");
            }
            if ("${userService.verified}" == "1") {
                $("#acceptMsg").val("接收");
                $("#acceptMsgBtn").html("不想接收");
            } else {
                $("#acceptMsg").val("不接收");
                $("#acceptMsgBtn").html("需要接收");
            }
        });
        function bindPhone() {
            parent.layer.open({
                                  title: false,
                                  type: 2,
                                  content: "/user/phoneNOBinding",
                                  area: ['500px', '400px'],
                                  end: function () {
                                      location.reload();
                                  }
                              });
        }
        function acceptChange() {
            $.ajax({
                       url: "/user/acceptMsg",
                       dataType: "json",
                       cache: false,
                       success: function (data) {
                           layer.alert(data.msg, function () {
                               location.reload();
                           });
                       }
                   });
        }
        function closeLayer() {
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        }
    </script>
    <%--<s:head/>--%>
</head>
<body>
<div align="center">
    <table align="center" style="white-space: nowrap;">
        <caption>基本资料</caption>
        <tr>
            <td>公司名称：</td>
            <td>${shipper.company}</td>
        </tr>
        <tr>
            <td>公司名称：</td>
            <td>${shipper.company}</td>
        </tr>
        <tr>
            <td>联系人：</td>
            <td>${shipper.name }</td>
        </tr>
        <tr>
            <td>联系电话：</td>
            <td>${shipper.phone }</td>
        </tr>
        <tr>
            <td>联系地址：</td>
            <td>${shipper.address}</td>
        </tr>
        <tr>
            <td>传真：</td>
            <td>${shipper.fax}</td>
        </tr>
        <tr>
            <td>邮箱：</td>
            <td>${shipper.email}</td>
        </tr>
        <tr>
            <td>手机号码：</td>
            <td><input STYLE="border:0;background:transparent;width:42%;" readonly
                       value="${userService.deviceCode}"/>
                <button id="bind" onclick="bindPhone()">立即绑定</button>
            </td>
        </tr>
        <tr id="acceptMsgTR">
            <td>接收信息：</td>
            <td><input id="acceptMsg" STYLE="border:0;background:transparent;width:42%;" readonly/>
                <button id="acceptMsgBtn" onclick="acceptChange()"/>
            </td>
        </tr>

        <tr>
            <td colspan="2" align="center">
                <button style="width: 120px;height: 25px;margin-top: 10px;"
                        onclick="closeLayer()">关闭
                </button>
            </td>
        </tr>
    </table>
</div>
</body>
</html>